﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static BindingLesson.Example.ColumnChartWindow;

namespace BindingLesson.DataCollection
{
    public class DataSource
    {
        public string Name { get; set; } = "Hello";

        public List<string> list { get; set; } = new List<string>() { "aaa", "bbb", "ccc" };
        public List<DataSourceItem> listNew { get; set; } = new List<DataSourceItem>() {
            new DataSourceItem(){id=1,Header="Item1",State=1 },
            new DataSourceItem(){id=2,Header="Item2",State=2 },
            new DataSourceItem(){id=3,Header="Item3",State=3 }
        };

        public DataSource()
        {
            listNew[0].Children.Add(new DataSourceItem() { Header = "Child1" });
            listNew[0].Children.Add(new DataSourceItem() { Header = "Child2" });
            listNew[1].Children.Add(new DataSourceItem() {Header = "Child3" });
            listNew[1].Children.Add(new DataSourceItem() {Header = "Child4" });
            listNew[2].Children.Add(new DataSourceItem() {Header = "Child5" });
            listNew[2].Children.Add(new DataSourceItem() {Header = "Child6" });

            listNew[0].Children[0].Children.Add(new DataSourceItem() { Header = "GrandChild1" });
        }
    }

    public class DataSourceItem
    {
        public int id { get; set; }
        public string Header { get; set; }
        public int State { get; set; }

        public List<DataSourceItem> Children { get; set; } = new List<DataSourceItem>();
    }
}
